home *** CD-ROM | disk | FTP | other *** search
/ PC Answers 1995 May / PC Answers CD-ROM 7 (Future Publishing) (May 1995).iso / vbits / code / cert / trk3_eg / vbx / frmmain.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1994-01-26  |  11.2 KB  |  419 lines

  1. VERSION 2.00
  2. Begin Form frmMain 
  3.    Caption         =   "Custom AutoLoad"
  4.    ClientHeight    =   3480
  5.    ClientLeft      =   1320
  6.    ClientTop       =   2265
  7.    ClientWidth     =   8475
  8.    Height          =   3885
  9.    Left            =   1260
  10.    LinkTopic       =   "Form1"
  11.    ScaleHeight     =   3480
  12.    ScaleWidth      =   8475
  13.    Top             =   1920
  14.    Width           =   8595
  15.    Begin CommandButton CmdClose 
  16.       Caption         =   "Cl&ose"
  17.       Height          =   495
  18.       Left            =   6960
  19.       TabIndex        =   22
  20.       Top             =   1560
  21.       Width           =   1215
  22.    End
  23.    Begin CommandButton cmdMove 
  24.       Caption         =   "Insert Co&m"
  25.       Height          =   375
  26.       Index           =   4
  27.       Left            =   3840
  28.       TabIndex        =   21
  29.       Top             =   2280
  30.       Width           =   1095
  31.    End
  32.    Begin PictureBox picBad 
  33.       BackColor       =   &H000000FF&
  34.       Height          =   285
  35.       Left            =   4485
  36.       Picture         =   FRMMAIN.FRX:0000
  37.       ScaleHeight     =   255
  38.       ScaleWidth      =   255
  39.       TabIndex        =   20
  40.       Top             =   3000
  41.       Visible         =   0   'False
  42.       Width           =   285
  43.    End
  44.    Begin PictureBox picGood 
  45.       BackColor       =   &H0000FF00&
  46.       Height          =   285
  47.       Left            =   4755
  48.       Picture         =   FRMMAIN.FRX:228FA
  49.       ScaleHeight     =   255
  50.       ScaleWidth      =   255
  51.       TabIndex        =   19
  52.       Top             =   3000
  53.       Visible         =   0   'False
  54.       Width           =   285
  55.    End
  56.    Begin TextBox txtEdit 
  57.       Height          =   285
  58.       Left            =   5040
  59.       TabIndex        =   18
  60.       Top             =   3000
  61.       Width           =   3015
  62.    End
  63.    Begin CommonDialog CMDialog1 
  64.       CancelError     =   -1  'True
  65.       Left            =   7680
  66.       Top             =   0
  67.    End
  68.    Begin CommandButton cmdSaveas 
  69.       Caption         =   "&Sa&ve As"
  70.       Height          =   495
  71.       Left            =   6960
  72.       TabIndex        =   16
  73.       Top             =   960
  74.       Width           =   1215
  75.    End
  76.    Begin CommandButton cmdCancel 
  77.       Cancel          =   -1  'True
  78.       Caption         =   "Cancel"
  79.       Height          =   495
  80.       Left            =   6960
  81.       TabIndex        =   13
  82.       Top             =   2400
  83.       Width           =   1215
  84.    End
  85.    Begin CommandButton cmdSave 
  86.       Caption         =   "&Save"
  87.       Default         =   -1  'True
  88.       Height          =   495
  89.       Left            =   6960
  90.       TabIndex        =   12
  91.       Top             =   360
  92.       Width           =   1215
  93.    End
  94.    Begin CommandButton cmdMove 
  95.       Caption         =   "&Clear <<"
  96.       Height          =   375
  97.       Index           =   3
  98.       Left            =   3840
  99.       TabIndex        =   11
  100.       Top             =   1800
  101.       Width           =   1095
  102.    End
  103.    Begin CommandButton cmdMove 
  104.       Caption         =   "A&ll >>"
  105.       Height          =   375
  106.       Index           =   2
  107.       Left            =   3840
  108.       TabIndex        =   10
  109.       Top             =   1320
  110.       Width           =   1095
  111.    End
  112.    Begin CommandButton cmdMove 
  113.       Caption         =   "&Delete <"
  114.       Height          =   375
  115.       Index           =   1
  116.       Left            =   3840
  117.       TabIndex        =   9
  118.       Top             =   840
  119.       Width           =   1095
  120.    End
  121.    Begin CommandButton cmdMove 
  122.       Caption         =   "&Add >"
  123.       Height          =   375
  124.       Index           =   0
  125.       Left            =   3840
  126.       TabIndex        =   8
  127.       Top             =   360
  128.       Width           =   1095
  129.    End
  130.    Begin ComboBox lstType 
  131.       Height          =   300
  132.       Left            =   1800
  133.       Style           =   2  'Dropdown List
  134.       TabIndex        =   7
  135.       Top             =   3000
  136.       Width           =   1935
  137.    End
  138.    Begin ListBox lstVBX 
  139.       Height          =   2175
  140.       Left            =   5040
  141.       TabIndex        =   3
  142.       Top             =   360
  143.       Width           =   1695
  144.    End
  145.    Begin DriveListBox Drive1 
  146.       Height          =   315
  147.       Left            =   120
  148.       TabIndex        =   2
  149.       Top             =   3000
  150.       Width           =   1575
  151.    End
  152.    Begin DirListBox Dir1 
  153.       Height          =   2055
  154.       Left            =   120
  155.       TabIndex        =   1
  156.       Top             =   360
  157.       Width           =   1575
  158.    End
  159.    Begin FileListBox File1 
  160.       Height          =   2175
  161.       Left            =   1800
  162.       TabIndex        =   0
  163.       Top             =   360
  164.       Width           =   1935
  165.    End
  166.    Begin Label lblEdit 
  167.       Caption         =   "Edit &Field"
  168.       Height          =   255
  169.       Left            =   5040
  170.       TabIndex        =   17
  171.       Top             =   2760
  172.       Width           =   1095
  173.    End
  174.    Begin Label lblDrive 
  175.       Caption         =   "Driv&e"
  176.       Height          =   255
  177.       Left            =   120
  178.       TabIndex        =   15
  179.       Top             =   2760
  180.       Width           =   1215
  181.    End
  182.    Begin Label Label1 
  183.       Caption         =   "Di&rectory"
  184.       Height          =   255
  185.       Left            =   120
  186.       TabIndex        =   14
  187.       Top             =   120
  188.       Width           =   1215
  189.    End
  190.    Begin Label lblvbx 
  191.       Caption         =   "Autoload VB&X List"
  192.       Height          =   255
  193.       Left            =   5040
  194.       TabIndex        =   6
  195.       Top             =   120
  196.       Width           =   1695
  197.    End
  198.    Begin Label lblsysVBX 
  199.       Caption         =   "&Installed VBX's"
  200.       Height          =   255
  201.       Left            =   1800
  202.       TabIndex        =   5
  203.       Top             =   120
  204.       Width           =   1815
  205.    End
  206.    Begin Label lblType 
  207.       Caption         =   "&Type"
  208.       Height          =   255
  209.       Left            =   1800
  210.       TabIndex        =   4
  211.       Top             =   2760
  212.       Width           =   1695
  213.    End
  214. Option Explicit
  215. Sub addAllvbx ()
  216. Dim i As Integer
  217.     If File1.ListCount > 0 Then
  218.         For i = 0 To File1.ListCount - 1
  219.             Dim addflag As Integer
  220.             Dim j As Integer
  221.             addflag = True
  222.             If lstvbx.ListCount > 0 Then
  223.                 For j = 0 To lstvbx.ListCount - 1
  224.                     If File1.List(i) = lstvbx.List(j) Then
  225.                         addflag = False
  226.                         Exit For
  227.                     End If
  228.                 Next
  229.             End If
  230.         If addflag Then lstvbx.AddItem File1.List(i)
  231.         Next
  232.     End If
  233. End Sub
  234. Sub Addvbx ()
  235. Dim i As Integer
  236. Dim addflag As Integer
  237. addflag = True
  238. If lstvbx.ListCount > 0 Then
  239.     For i = 0 To lstvbx.ListCount - 1
  240.         If File1.List(File1.ListIndex) = lstvbx.List(i) Then
  241.             addflag = False
  242.             Exit For
  243.         End If
  244.     Next
  245. End If
  246. reposList (File1.List(File1.ListIndex))    'Adds item a put in proper place
  247. End Sub
  248. Sub cmdCancel_Click ()
  249. Unload Me
  250. End Sub
  251. Sub cmdClose_Click ()
  252. Dim rs As Integer
  253. If listchange Then
  254.     rs = MsgBox("Your vbx list has changed would you like to save before closing.", MB_YesNO, "Closing")
  255.     Select Case rs
  256.         Case IDYes
  257.             'Go back to main dialog box
  258.         Case IDNo
  259.             Unload Me
  260.     End Select
  261.     Unload Me
  262. End If
  263. End Sub
  264. Sub cmdMove_Click (index As Integer)
  265. Select Case index
  266.     Case 0
  267.         Addvbx
  268.     Case 1
  269.         removevbx
  270.     Case 2
  271.         addAllvbx
  272.     Case 3
  273.         lstvbx.Clear
  274.     Case 4
  275.         InsertCom
  276. End Select
  277. End Sub
  278. Sub cmdSave_Click ()
  279. If frmmain.Caption = "*.AVB" Then
  280.     cmdSaveas_Click
  281. Fillfile curmodfile
  282. End If
  283. listchange = False
  284. End Sub
  285. Sub cmdSaveas_Click ()
  286. Dim rs As String
  287. Dim passfilename As String
  288. passfilename = frmmain.Caption
  289. rs = saveasvbx(passfilename)
  290. curmodfile = rs
  291. If rs = "cancel" Then
  292.     Exit Sub
  293. End If
  294. frmmain.Caption = rs
  295. Fillfile rs
  296. listchange = False
  297. End Sub
  298. Sub Dir1_Change ()
  299. File1.Path = Dir1.Path
  300. End Sub
  301. Sub Drive1_Change ()
  302. Dir1.Path = Drive1.Drive
  303. End Sub
  304. Sub Editoff ()
  305.     picBad.Visible = False
  306.     picGood.Visible = False
  307. End Sub
  308. Sub EditOn ()
  309.     picBad.Visible = True
  310.     picGood.Visible = True
  311. End Sub
  312. Sub File1_DblClick ()
  313. Dim i As Integer
  314. Call Addvbx
  315. End Sub
  316. Sub Form_Load ()
  317. Dim winSysPath As String
  318. lstType.AddItem "VBX (*.VBX)"
  319. lstType.AddItem "All (*.*)"
  320. lstType.ListIndex = 0
  321. Windir = FindWinDir()
  322. Drive1.Drive = Left$(Windir, 2)
  323. winSysPath = Windir & "system\"
  324. Dir1.Path = winSysPath
  325. Editoff
  326. End Sub
  327. Sub InsertCom ()
  328. End Sub
  329. Sub lstType_Click ()
  330. Dim newpattern As String
  331. Dim stpos As Integer
  332. Dim Endpos As Integer
  333. newpattern = lstType.Text
  334. stpos = InStr(1, newpattern, "(")
  335. Endpos = InStr(1, newpattern, ")")
  336. newpattern = Mid(newpattern, stpos + 1, Endpos - stpos - 1)
  337. File1.Pattern = newpattern
  338. End Sub
  339. Sub lstVBX_Click ()
  340. Dim listline As String
  341. listline = lstvbx.Text
  342. If Not (Right$(listline, 4) = ".VBX" Or Left$(listline, 1) = "'") Then
  343.     txtedit.Text = listline
  344.     EditOn
  345.     txtedit.Text = ""
  346.     Editoff
  347. End If
  348. listchange = True
  349. End Sub
  350. Sub lstVBX_DblClick ()
  351.     removevbx
  352. End Sub
  353. Sub picBad_Click ()
  354. Editoff
  355. End Sub
  356. Sub picCancel_Click ()
  357. Editoff
  358. End Sub
  359. Sub picGood_Click ()
  360. Dim rs As Integer
  361. Editoff
  362. rs = MsgBox("Are you sure you would like to update the line:  " & lstvbx.Text, MB_YesNO, "Confirm edits!!")
  363. Select Case rs
  364.     Case IDYes
  365.         lstvbx.Text = txtedit.Text
  366. End Select
  367. End Sub
  368. Sub picInput_Click ()
  369. Editoff
  370. End Sub
  371. Sub removevbx ()
  372. If Not (lstvbx.ListCount = 0 Or Left(lstvbx.Text, 8) = "ProjWinS") Then
  373.     lstvbx.RemoveItem lstvbx.ListIndex
  374. End If
  375. End Sub
  376. Sub reposList (insertdata As String)
  377. Dim curindex As Integer
  378. Dim curlistcount As Integer
  379. Dim tempcnt As Integer
  380. Dim templistdata() As String
  381. Dim cnt As Integer
  382. Dim bottommes As String
  383. Dim bottomrs As Integer
  384. Dim rs As Integer
  385. curindex = lstvbx.ListIndex
  386. curlistcount = lstvbx.ListCount
  387. If curindex = -1 And curlistcount <= 2 Then
  388.     curindex = curlistcount - 2
  389. ElseIf curindex = -1 And Not curlistcount = 0 Then
  390.     bottommes = "You have not specified a location to put this vbx in the list.  Would you like to put the vbx control on the bottom of the list?"
  391.     rs = MsgBox(bottommes, MB_YesNO, "VBX position alert")
  392.     Select Case rs
  393.         Case IDYes
  394.             curindex = curlistcount - 2
  395.         Case IDNo
  396.             Exit Sub
  397.     End Select
  398. End If
  399. If curindex >= curlistcount - 1 Then
  400.     MsgBox "The ProjWinSize and the ProjWinS must be the last two entries in the VBX file.  Your add can not be completed."
  401.     ReDim templistdata(1 To curlistcount - curindex) As String
  402.     For cnt = curlistcount - 1 To curindex Step -1
  403.         tempcnt = tempcnt + 1
  404.         templistdata(tempcnt) = lstvbx.List(cnt)
  405.         lstvbx.RemoveItem cnt
  406.     Next cnt
  407.     lstvbx.AddItem UCase$(insertdata)
  408.     For cnt = 1 To tempcnt
  409.         lstvbx.AddItem templistdata(cnt)
  410.     Next
  411. End If
  412. End Sub
  413. Sub txtEdit_Change ()
  414.     EditOn
  415. End Sub
  416. Sub txtEditField_GotFocus ()
  417. EditOn
  418. End Sub
  419.